/*****************************************************************************
 * $LastChangedDate: 2009-11-22 18:05:48 -0500 (Sun, 22 Nov 2009) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   OSG-specific Keyboard class.
 *//*
 * LEGAL:   COPYRIGHT (C) 2007 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#if COMPILE_OSG
#ifndef INPUT_DEVICE_KEYBOARD_OSG_HH
#define INPUT_DEVICE_KEYBOARD_OSG_HH 1

#include "input/device_keyboard.hh"

#if OS_LINUX
#undef KEY_F1  // workaround linux/input.h
#undef KEY_F2 
#undef KEY_F3
#undef KEY_F4
#undef KEY_F5
#undef KEY_F6
#undef KEY_F7
#undef KEY_F8
#undef KEY_F9
#undef KEY_F10
#undef KEY_F11
#undef KEY_F12
#undef KEY_F13
#endif // OS_LINUX

#include <osgGA/GUIEventHandler>
#include <osg/Version>

namespace input {

////////////////////////////////////////////////////////////////////////////////
/// @brief Keyboard class specialized for OSG.
///
/// This is a private implementation of KeyboardDevice.
/// KeyboardDeviceOSG and MouseDeviceOG are similar.
///
class KeyboardDeviceOSG : public KeyboardDevice
{
PREVENT_COPYING(KeyboardDeviceOSG)
friend class KeyboardDevice;
private:
                    KeyboardDeviceOSG( void );
    virtual         ~KeyboardDeviceOSG();
    virtual bool    EnableDevice( void );  // implement Device abstract method

    /// @brief Handles keyboard events (OSG).
    class HandlerOSG : public osgGA::GUIEventHandler
    {
    public:
                        HandlerOSG( void ) { }
        virtual         ~HandlerOSG() { }
        virtual bool    handle( const osgGA::GUIEventAdapter& event, osgGA::GUIActionAdapter& action );
#if OSG_VERSION_LESS_THAN(3,0,0)
        virtual void    accept( osgGA::GUIEventHandlerVisitor& visitor );
#endif
    };
};

} // namespace input

#endif // INPUT_DEVICE_KEYBOARD_OSG_HH
#endif // COMPILE_OSG
